<%@page import="entity.Teacher1"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script>
        window.onload=function () {
            var oBtn=document.getElementById('id');
            oBtn.onclick = function () {
                //1.创建Ajax对象 oAjax.readyState==0未初始化
                if(window.XMLHttpRequest){
                    //非IE6
                    var oAjax=new XMLHttpRequest();
                }else {
                    //IE6
                    var oAjax=new ActiveXObject("Microsoft.XMLHTTP");
                }
                //2.连接服务器oAjax.readyState==1载入
                //open(方法，文件名，异步传输)  ?t='+new Date().getTime()实时刷新s
                oAjax.open('GET','/teacher/TeacherInsertServlet2',true);
                //3.发送请求oAjax.readyState==3载入完成
                oAjax.send();
                //4.接收返回oAjax.readyState==3解析oAjax.readyState==4解析完成
                oAjax.onreadystatechange=function () {
                    //oAjax.readyState 浏览器和服务器，进行到哪一步了
                    if(oAjax.readyState==4){//读取完成
                        if(oAjax.status==200){//成功200
                            alert('成功:'+oAjax.responseText);
                        }else{
                            alert('失败'+oAjax.status);//失败404
                        }
                    }
                };
            };
        };
    </script>
</head>

<body>
	<form  action="teacherinsert2" method="get">
	<table align="center">
		<caption>
			<h3 align="center">欢迎进入添加页面</h3>
		</caption>
		<tr>
			<td>请输入工号</td>
			<td>
				<input type="text" id="id" name="id">
			</td>
		</tr>
		<tr>
			<td>请输入姓名</td>
			<td>
				<input type="text" name="name">
			</td>
		</tr>
		<tr>
			<td>请输入身份证号码</td>
			<td>
				<input type="text" name="idcard">
			</td>
		</tr>
		<tr>
			<td>请输入院系</td>
			<td>
				<input type="text" name="department">
			</td>
		</tr>
		<tr>
			<td>请输入电话号码</td>
			<td>
				<input type="text" name="phone">
			</td>
		</tr>
		<tr>
			<td colspan="2" align="center">
				<input type="submit" value="提交" > 
			</td>
		</tr>
	</table>
</form>

</body>
</html>